package com.cdvtc.news.web.admin;

import com.cdvtc.news.entity.Admin;
import com.cdvtc.news.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/admin/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @RequestMapping
    public String list(Model model) {
        List<Admin> adminList = adminService.getAllAdmins();
        model.addAttribute("adminList", adminList);
        return "admin/admin-list";
    }
}
